package com.apiit.webserviceclient.activities;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import com.apiit.webserviceclient.Adapter;
import com.apiit.webserviceclient.R;
import com.apiit.webserviceclient.R.layout;
import com.apiit.webserviceclient.R.menu;
import com.apiit.webserviceclient.utility.BPEL_Process;
import com.apiit.webserviceclient.utility.BPEL_Request;
import com.apiit.webserviceclient.utility.BPEL_Response;
import com.apiit.webserviceclient.utils.Book;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
import android.widget.ListView;
import android.widget.TableLayout;
import android.widget.TableRow;
import android.widget.TextView;

public class OPACSearchResult extends Activity {
	TextView test;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_opacsearch_result);

		TableLayout table = (TableLayout) findViewById(R.id.tableLayouttest);

		Intent i = getIntent();
		String[] value = i.getStringArrayExtra("message");
		
		for(int r=2;r<value.length-8;r++)
		{
		    TableRow row=new TableRow(this);          /////////////// //   /////
		    String title = value[r].trim();
		    String itemCode = value[r+1].trim();
		    String isbn = value[r+2].trim();
		    String author = value[r+3].trim();
		    String type = value[r+4].trim();
		    String cat = value[r+5].trim();
		    
		    TextView titlevalue=new TextView(this);
		    titlevalue.setText(""+title +"\t");
		    titlevalue.setTextSize(14);
		   
		    TextView itemCodevalue=new TextView(this);
		    itemCodevalue.setText(""+itemCode+"\t");
		    itemCodevalue.setTextSize(14);
		    
		    TextView isbnvalue=new TextView(this);
		    isbnvalue.setText(""+isbn +"\t");
		    isbnvalue.setTextSize(14);
		    
		    TextView bDatevalue=new TextView(this);
		    bDatevalue.setText(""+author +"\t");
		    bDatevalue.setTextSize(14);
		   
		    TextView rDatevalue=new TextView(this);
		    rDatevalue.setText(""+type+"\t");
		    rDatevalue.setTextSize(14);
		    
		    TextView catvalue=new TextView(this);
		    catvalue.setText(""+cat+"\n");
		    catvalue.setTextSize(14);
		    
		    row.addView(titlevalue);
		    row.addView(itemCodevalue);
		    row.addView(isbnvalue);
		    row.addView(bDatevalue);
		    row.addView(rDatevalue);
		    row.addView(catvalue);
		    table.addView(row);
		    r= r+7;
		}
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.opacsearch_result, menu);
		return true;
	}

}
